#!/usr/bin/env python
#coding: utf-8
##############################################################################
## 参考了supervisord的setup.py的编写方式.
##############################################################################
import os, sys
from setuptools import setup, find_packages

## 当前文件的绝对路径(无当前文件名, 只有所在目录路径)
pwd = os.path.abspath(os.path.dirname(__file__))

## 版本号
ver_txt = os.path.join(pwd, 'pyadmin/version')
pyadmin_ver = open(ver_txt).read().strip()

## 依赖包
requires = [
    'Flask==0.12', 
    'PyYAML==3.12',    
]

## 根据不同的python版本安装不同版本的APScheduler
if sys.version_info[:2] >= (2, 4) and sys.version_info[:2] <= (2, 5):
    requires.append('APScheduler==1.3.1')
elif sys.version_info[:2] > (2, 5) and sys.version_info[:2] < (2, 7):
    requires.append('APScheduler==2.1.2')
else:
    requires.append('APScheduler==3.3.1')

dist = setup(
    name = "pyadmin",             # 包名
    version = pyadmin_ver,        # 版本信息
    ## packages = find_packages(),  # 要打包的项目文件夹
    packages = find_packages(),
    namespace_packages = ['pyadmin'],
    include_package_data=True,    # 自动打包文件夹内所有数据
    package_data = {
        'ver_file': ['pyadmin/version']
    },
    zip_safe=False,               # 设定项目包为非安全, 不用每次都检测其安全性

    install_requires = requires,

    # 设置程序的入口为hello
    # 安装后, 命令行执行hello相当于调用hello.py中的main方法
    entry_points={
        'console_scripts':[
            'pyadmin = pyadmin.pyadmind:main',
            'pyctl = pyadmin.pyctl:main'
        ]
     },

    # 如果要上传到PyPI, 则添加以下信息
    author = "general",
    author_email = "generals.space@gmail.com",
    description = "process manager",
    license = "MIT",
    url = "",   
)